Dynomotion

Group: DynoMotion Message: 13712 From: lmp582002 Date: 8/29/2016
Subject: Execute Program
I am trying to understand the "Execute Program" function in the help file. I have been successful in opening a program from a specified location, but am trying to understand the following:

"If the Filename is left blank, then it will be assumed that a program has been previously downloaded and will just be re-executed."

How exactly would I previously download a program? How is this intended to be accomplished? I know that I can save a program so it will auto launch on Power up, but I though this was discouraged. 

I am trying to do this because it seems to execute MUCH faster in my G-Code. 

Thanks,

Scott
 
 
Group: DynoMotion Message: 13713 From: Tom Kerekes Date: 8/29/2016
Subject: Re: Execute Program

Hi Scott,

Yes you must have previously download the program to a KFLOP Thread memory space somehow before it can be executed .  You might Flash it.  The only reason we discourage this is because it can be confusing.  You must keep track of what program is Flashed into what Thread.  If you change KFLOP boards or upgrade firmware you will need to re-flash the the program into that Thread.  It also means all the default KFLOP Settings with thereafter be whatever they were when User Data was Flashed rather than the normal defaults.  This usually is not a problem but something to be aware of.  If it gives a significant performance improvement it might be worth the trouble.

Another option is to have a different M Code or Action such as as "Prog Start" configured to download/Compile/Execute the program first one time.  If it is a problem having the Program execute the first time the "Var" variable will contain the Action Code which might be tested in the c Program to determine if it should really do something or not.

Yet another option might be to have the C Program code exist in your Init program and just trigger it by setting a Virtual I/O bit that the INit C Code can be monitoring.  This method will have the highest performance with potentially zero delay in the GCode and the C Code will begin execution within 180us of the trigger point.

It might be helpful to know what your program needs to do.

HTH

Regards

TK 


On 8/29/2016 3:06 PM, lmp582002@... [DynoMotion] wrote:
 

I am trying to understand the "Execute Program" function in the help file. I have been successful in opening a program from a specified location, but am trying to understand the following:


"If the Filename is left blank, then it will be assumed that a program has been previously downloaded and will just be re-executed."

How exactly would I previously download a program? How is this intended to be accomplished? I know that I can save a program so it will auto launch on Power up, but I though this was discouraged. 

I am trying to do this because it seems to execute MUCH faster in my G-Code. 

Thanks,

Scott
 
 

Group: DynoMotion Message: 13714 From: lmp582002 Date: 8/30/2016
Subject: Re: Execute Program
Tom,

Thanks so much for the reply. Could you help me understand a bit more the "VAR" variable in KmotionCNC? I have used this to pass in spindle speed to jog my spindle at different speeds. How could this be used to not run the program the first time, but to run it the second time?

I have also been trying to understand persist variables. I read through "MCodes with Parameters" in the help file. When an MCode writes in a value - is this value then available to all threads? Can I call the value UserData[0] in any thread? Also, is there a limit of 3 values - meaning if I have one MCode with a Q value, and then I have a second M code with another Q value will it over right the value? 

Thanks,

Scott
Group: DynoMotion Message: 13715 From: Tom Kerekes Date: 8/30/2016
Subject: Re: Execute Program

Hi Scott,

Please see this article to see if it helps:

http://www.dynomotion.com/wiki/index.php?title=Invoking_C_Programs_with_Execute_Only_for_previously_Downloaded_Programs

Persist variables are "persistent" in the sense that they exist globally and statically across Threads and and from one execution to the next.  So once they are set they will remain set until changed or power is lost.  All persist variables are accessible to be read or written to by all programs all the time.

There is a limit of 3 values P Q R being set to persist Variables each time an M Code is invoked.  However different M Codes can set different persist variables by changing the Var setting to different values.

HTH
Regards
TK


On 8/30/2016 8:19 AM, lmp582002@... [DynoMotion] wrote:
 

Tom,


Thanks so much for the reply. Could you help me understand a bit more the "VAR" variable in KmotionCNC? I have used this to pass in spindle speed to jog my spindle at different speeds. How could this be used to not run the program the first time, but to run it the second time?

I have also been trying to understand persist variables. I read through "MCodes with Parameters" in the help file. When an MCode writes in a value - is this value then available to all threads? Can I call the value UserData[0] in any thread? Also, is there a limit of 3 values - meaning if I have one MCode with a Q value, and then I have a second M code with another Q value will it over right the value? 

Thanks,

Scott

Group: DynoMotion Message: 13716 From: lmp582002 Date: 8/30/2016
Subject: Re: Execute Program
I think I got it. In my INIT program, I will run a special user button which will load the program into the thread with a variable to test. Then when I actually want to run it I will do so with an MCode and the correct test variable which will allow the program to execute.

Thanks,

Scott